<template>
  <div class="dashboard-editor-container">
    <panel-group @handleSetLineChartData="handleSetLineChartData"/>
    <el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
      <!--<line-chart :chart-data="lineChartData" :x-axis-data="xAxisData"/>-->
      <line-chart1 v-if="type !== 'total_web'" :chart-data="lineChartData" :x-axis-data="xAxisData" :auto-data="autoData"/>
      <line-chart2 v-else :chart-data="lineChartData" :x-axis-data="xAxisData" :auto-data="autoData"/>
      <!--<line-chart1></line-chart1>-->
    </el-row>
    <el-row :gutter="32">
      <el-col :xs="24" :sm="24" :lg="8">
        <div class="chart-wrapper">
          <raddar-chart/>
        </div>
      </el-col>
      <el-col :xs="24" :sm="24" :lg="8">
        <div class="chart-wrapper">
          <pie-chart/>
        </div>
      </el-col>
      <el-col :xs="24" :sm="24" :lg="8">
        <div class="chart-wrapper">
          <bar-chart/>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import PanelGroup from './components/PanelGroup'
import LineChart from './components/LineChart'
import LineChart1 from './components/LineChart1'
import LineChart2 from './components/LineChart2'
import RaddarChart from './components/RaddarChart'
import PieChart from './components/PieChart'
import BarChart from './components/BarChart'

const lineChartData = {
  total_today: {
    actuData: [100, 120, 161, 134, 105, 160, 165],
    xAxisData: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
    autoData: ['当日采集']
  },
  total_web: {
    imf: [200, 192, 120, 144, 160, 130, 140],
    cnbc: [150, 12, 111, 44, 10, 130, 140],
    reuters: [50, 102, 11, 44, 150, 170, 40],
    xAxisData: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
    autoData: ['网站采集']
  },
  total_file: {
    actuData: [80, 100, 121, 104, 105, 90, 100],
    xAxisData: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
    autoData: ['当日生成']
  },
  shoppings: {
    actuData: [130, 140, 141, 142, 145, 150, 160],
    xAxisData: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
  }
}

export default {
  name: 'DashboardAdmin',
  components: {
    PanelGroup,
    LineChart,
    LineChart1,
    LineChart2,
    RaddarChart,
    PieChart,
    BarChart
  },
  data() {
    return {
      lineChartData: lineChartData.total_today,
      type: 'total_today',
      autoData: lineChartData.total_today.autoData,
      xAxisData: lineChartData.total_today.xAxisData
    }
  },
  methods: {
    handleSetLineChartData(type) {
      this.lineChartData = lineChartData[type]
      this.xAxisData = lineChartData[type].xAxisData
      this.type = type
      this.autoData = lineChartData[type].autoData
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.dashboard-editor-container {
  padding: 32px;
  background-color: rgb(240, 242, 245);
  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    margin-bottom: 32px;
  }
}
</style>
